import { hitokotoType } from "../type/hitokoto";
import { translateHitokotoType } from "./hitokotoTypeMap";

export default function getHitokotoUrl(c: hitokotoType[], minlen=0, maxlen=30) {
  const getTypeParameter: string = c
    ? c.map(value => `c=${translateHitokotoType(value)}`).join("&")
    : "";
  const getMinlenParameter: string = `min_length=${minlen.toString()}`;
  const getMaxlenParameter: string = `max_length=${maxlen.toString()}`;
  const getUrl: string = `/hitokoto?${
    getMinlenParameter + "&" + getMaxlenParameter
  }&${getTypeParameter}`;
  return getUrl;
}
